<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./template.xhtml">

            <ui:define name="title">
                Add TimeTable
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <table align="center" width="500px">
                        <tr>
                            <td colspan="2" align="center"><h3>Add New TimeTable</h3></td><td></td>
                        </tr>
                        <tr>
                            <td colspan="3"><p:messages id="messages" showDetail="true" autoUpdate="true"  globalOnly="true"/></td>
                        </tr>
                        <tr>
                            <td>Lab Name</td>
                            <td>
                                <h:selectOneMenu value="#{addTimeTableBean.labid}" id="labname" required="true" requiredMessage="Lab empty !">
                                    <f:selectItems value="#{addTimeTableBean.labs}" var="l" itemLabel="#{l.labname}" itemValue="#{l.labID}" />
                                </h:selectOneMenu>
                            </td>
                            <td><p:message for="labname" /></td>
                        </tr>
                        <tr>
                            <td>Username</td>
                            <td>
                                <h:selectOneMenu value="#{addTimeTableBean.userid}" id="username" required="true" requiredMessage="Username empty !">
                                    <f:selectItems value="#{addTimeTableBean.users}" var="u" itemLabel="#{u.username}" itemValue="#{u.userID}" />
                                </h:selectOneMenu>
                            </td>
                            <td><p:message for="username" /></td>
                        </tr>
                        <tr>
                            <td>Start Time</td>
                            <td><p:calendar id="start" value="#{addTimeTableBean.start}" pattern="HH:mm" timeOnly="true" required="true" requiredMessage="Choice Time !" effect="explode"/></td>
                            <td><p:message for="start" /></td>
                        </tr>
                        <tr>
                            <td>End Time</td>
                            <td><p:calendar id="end" value="#{addTimeTableBean.end}" pattern="HH:mm" timeOnly="true" required="true" requiredMessage="Choice Time !" effect="explode"/></td>
                            <td><p:message for="end" /></td>
                        </tr>
                        <tr>
                            <td>Description</td>
                            <td><h:inputTextarea value="#{addTimeTableBean.description}" id="desc" required="true" requiredMessage="Description invalid!" /></td>
                            <td><p:message for="desc" /></td>
                        </tr>
                        <tr>
                            <td></td><td><h:commandButton value="Add TimeTable" action="#{addTimeTableBean.resultAdd}"  /></td><td></td>
                        </tr>
                    </table>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
